{extends file="./main.tpl"}
{block name=head}
<link href="css/user.css" rel="stylesheet" type="text/css" />
<script src="./js/jquery.min.js">
</script>
<script type="text/javascript">
function myFunction()
{
	if(confirm("Are You Sure To Delete")== true)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function myFunctionActive()
{
	if(confirm("Do You Want To Active User")== true)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function myFunctionDeactive()
{
	if(confirm("Do You Want To Deactive User")== true)
	{
		return true;
	}
	else
	{
		return false;
	}
}
</script>
<script language="javascript">
function fncSubmit()
{
	if(document.form1.password.value == "")
	{
		alert('Please input Password');
		document.form1.password.focus();		
		return false;
	}	

	if(document.form1.retypePassword.value == "")
	{
		alert('Please input Confirm Password');
		document.form1.retypePassword.focus();		
		return false;
	}	

	if(document.form1.password.value != document.form1.retypePassword.value)
	{
		alert('Confirm Password Not Match');
		document.form1.retypePassword.focus();		
		return false;
	}	
document.form1.submit();
}
</script>
{/block}
{block name="body"}
<form name="form1" action="{$smarty.server.PHP_SELF}" method="POST" class="register" style="margin-top: 27px;" OnSubmit="return fncSubmit();"> 
<body>
<h1 align="center" style="font-size:px; color:#5BA7E9;">CREATE USER</h1>
<tbody id="mainDiv">
<tr id="one">
	<td><input type="text" name="company" class="text-field" placeholder="Company" AUTOFOCUS REQUIRED></td>
</tr>
<tr id="one">
	<td><input type="text" name="fName" class="text-field" placeholder="First Name"></td><br />
</tr>
<tr>
	<td><input type="text" name="mName" class="text-field" placeholder="Middle Name"></td>
  </tr>
	<tr>
	<td><input type="text" name="lName" class="text-field" placeholder="Last Name"></td><br />
	</tr>
	<tr>
	<td><input type="text" name="ph1" class="text-field" placeholder="Phone 1" REQUIRED /></td>
	</tr>
	<tr>
	<td><input type="text" name="ph2" class="text-field" placeholder="Phone 2"></td><br />
	</tr>
	<tr>
	<td><input type="text" name="email" class="text-field" placeholder="Email" REQUIRED></td>
	</tr>
	<tr>
	<td><input type="text" name="web" class="text-field" placeholder="Web"></td><br />
	</tr>
	<tr>
	<td><input type="password" name="password" id="password" class="password text-field" placeholder="password" REQUIRED></td>
	</tr>
	<tr>
	<td><input type="password" name="retypePassword" id="retypePassword" class="retypePassword  text-field" placeholder="Retype-Password" REQUIRED></td><br />
	</tr>
</tr>
</tbody>
<tr>
	<td colspan="3" align="center"><input type="submit" name="submit" value="Submit" class="button"></td>
</tr>
</body>
</form>
<br/>
<br/>
<table align="center" border="1" cellpadding="3" cellspacing="0">
  
	<tr>
	  <td colspan="12"><h1 align="center" style="color:#5BA7E9;">USER LIST</h1></td>	
  </tr>
	<tr style="font-style:normal; color:#a6a6a6; font-size:17px;">
		<td align="center">&nbsp;</td>
		<td align="center"><b>Company</b></td>
		<td align="center"><b>First&nbsp;name</b></td>
		<td align="center"><b>Middle&nbsp;name</b></td>
		<td align="center"><b>Last&nbsp;name</b></td>
		<td align="center"><b>Phone&nbsp;1</b></td>
		<td align="center"><b>Phone&nbsp;2</b></td>
		<td align="center"><b>Email</b></td>
		<td align="center"><b>Password</b></td>
		<td align="center"><b>Web</b></td>
		<td align="center"><b>Status</b></td>
  </tr>
  {section name="sec" loop=$userArray}
  <tr>
  	<td align="center"><a href="userDelete.php?userId={$userArray[sec].userId}" style="font-size:15px; color:#5BA7E9; text-decoration: none;" onclick="return myFunction();"><b>Delete</b></a>
  	<td align="center">{$userArray[sec].company}</td>
  	<td align="center">{$userArray[sec].fName}</td>
  	<td align="center">{$userArray[sec].mName}</td>
  	<td align="center">{$userArray[sec].lName}</td>
  	<td align="center">{$userArray[sec].ph1}</td>
  	<td align="center">{$userArray[sec].ph2}</td>
  	<td align="center">{$userArray[sec].email}</td>
  	<td align="center">{$userArray[sec].password}</td>
  	<td align="center">{$userArray[sec].web}</td>
  	{if $userArray[sec].status eq 'D'}
  	  <td align="center" class="text-field" NOWRAP><a href="activeDeactiveUser.php?userId={$userArray[sec].userId}&status=A" onclick="return myFunctionActive();" style="font-size:15px; color:#5BA7E9; text-decoration: none;"><b>Active User<b/></a>
  	{else}
  	  <td align="center" class="text-field" NOWRAP><a href="activeDeactiveUser.php?userId={$userArray[sec].userId}&status=D" onclick="return myFunctionDeactive();" style="font-size:15px; color:#5BA7E9; text-decoration: none;" ><b>Deactive User<b/></a>
  	{/if}
  </tr>
 {/section}
</table>
{/block}
